﻿namespace SampleApplication
{
    #region Usings

    using Microsoft.Practices.Unity;
    using UnitTestInjector;

    #endregion Usings

    public class UnityDependencyResolver : IDependencyResolver
    {
        private readonly IUnityContainer container;

        public UnityDependencyResolver(IUnityContainer container)
        {
            this.container = container;
        }

        public void RegisterType<TDependency, TImplementation>() where TImplementation : TDependency
        {
            container.RegisterType<TDependency, TImplementation>();
        }

        public TDependency Resolve<TDependency>() where TDependency : class
        {
            return container.Resolve<TDependency>();
        }

        public void RegisterInstance<TDependency>(TDependency implementation)
        {
            container.RegisterInstance(implementation);
        }
    }
}